#ifndef GLWIDGET_H
#define GLWIDGET_H

#include <QGLWidget>
#include <QMouseEvent>

#include <fstream>
using namespace std;

class FenetrePrincipale;
class MoteurGraphique;
class MoteurJeu;

#include "modeles/piece.h"
#include "modeles/tour.h"
#include "modeles/cavalier.h"
#include "modeles/fou.h"
#include "modeles/reine.h"
#include "modeles/roi.h"
#include "modeles/pion.h"
#include "modeles/case.h"
#include "partie.h"

class GLWidget : public QGLWidget {
    Q_OBJECT

    public:
        GLWidget(FenetrePrincipale *fenetrePrincipale);
        
        void setPicking(bool picking_on);

    protected:
        void initializeGL();
        void resizeGL(int width, int height);
        void paintGL();
        void mousePressEvent(QMouseEvent *event);
        void mouseMoveEvent(QMouseEvent *event);
        void mouseDoubleClickEvent(QMouseEvent *event);

    private:
        FenetrePrincipale *parent;
        bool picking;

        void dessinerPicking();
        void traiterPicking(int x, int y);

};

#endif // GLWIDGET_H
